package com.moyou.weichat.listener;

import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;

import com.moyou.weichat.utils.ConstantUtils;
import com.victor.loading.rotate.RotateLoading;

/**
 * Created by Administrator on 2017/11/7 0007.
 * sj： 2017年11月7日16:01:27
 * name: ts
 * 用途： 改变UI的Hander
 */

public class ChatConnctionUIHandler extends Handler {
    private RelativeLayout chatLinkState;
    private RotateLoading rotateLoading;

    public ChatConnctionUIHandler(RelativeLayout chatLinkState, RotateLoading rotateLoading) {
        this.chatLinkState = chatLinkState;
        this.rotateLoading = rotateLoading;
    }

    @Override
    public void handleMessage(Message msg) {
        super.handleMessage(msg);
        switch (msg.what){
            case ConstantUtils.TYPE_NUMBER:
                // 显示链接异常的布局
                chatLinkState.setVisibility(View.VISIBLE);
                rotateLoading.start();
                break;
            case ConstantUtils.TYPE_NUMBER_ONE:
                //隐藏布局
                chatLinkState.setVisibility(View.GONE);
                rotateLoading.stop();
                break;
        }
    }
}
